7 'Permission to copy this program is granted except for commercial gain.
8 '
9 '
10 'This program will send a formatted listing of a PCBASIC program to the
11 'printer. Multiple file names will be accepted separated by commas. All
12 'input files must be ASCII-saved files. The default extension is .LST.
13 'The listing will have each statement on a separate line with THEN/ELSE
14 'statements aligned. Condensed printing can be obtained by using the /W
15 'switch at the end of the file query response.
16 '
17 'This program has the printer codes for the IBM 80 cps (EPSON) printer.
18 'Users of other printers should put the proper control codes in line 110.
19 '
20 'Some printers do not turn off double width at the end of a line. To cover
21 'these cases, I have added a variable SW$ for single width in line 110
22 'and used it in line 380. I also added the time in lines 125 and 380.
23 '9/1/84
24 '
100 DEFINT A-Z
110 COFF$=CHR$(29):CON$=CHR$(31):DW$=CHR$(1):SW$=CHR$(20):FF$=CHR$(12):'COMPRESS OFF/ON, DOUBLE WIDTH, SINGLE WIDTH, TOP OF FORM FOR IBM (EPSON) PRINTER
120 ON ERROR GOTO 390:Q$=CHR$(34):C$=CHR$(58):L$=CHR$(10):CLS:PRINT TAB(10);"BASIC FORMAT AND LIST PROGRAM":PRINT:PRINT TAB(10);"LIST 1-24 for instructions":PRINT:PRINT TAB(10);"Files must be saved in ASCII":PRINT:LPRINT COFF$;
125 DATE.F$=DATE$:TIME.F$=LEFT$(TIME$,5) 'fix date and time
130 LINE INPUT "File name(s):";FS$:IF RIGHT$(FS$,2)="/W" THEN FS$=LEFT$(FS$,LEN(FS$)-2):WIDTH "LPT1:",132:LPRINT CON$;:IF PE THEN PRINT"THANKS!":PE=0
140 IF LEN(FS$)=0 THEN GOTO 480
150 FD=INSTR(FS$,","):IF FD=0 THEN FD=LEN(FS$)+1
160 F$=LEFT$(FS$,FD-1):IF INSTR(F$,".")=0 THEN F$=F$+".LST":GOTO 170
170 OPEN "I",1,F$:GOSUB 380:IF PE THEN PRINT"THANKS!":PE=0
180 LINE INPUT #1,LIN$:LN=LEN(LIN$):T=7:P=INSTR(LIN$," ")+1:PLN=1:X=P:R=999
190 X$="'":GOSUB 320:R=NT:X$="REM ":GOSUB 320:IF R=0 AND NT=0 THEN R=999
200 IF NT AND NT<R THEN R=NT
210 LT=INSTR(X,LIN$,Q$):ST=INSTR(X,LIN$,C$)
220 IF ST=0 OR ST>R THEN P2=LN:GOTO 250
230 IF LT=0 OR ST<LT THEN P2=ST:GOTO 250
240 LT2=INSTR(LT+1,LIN$,Q$):IF LT2 THEN X=LT2+1:GOTO 210 ELSE P2=LN
250 L=L+1:IF L>55 THEN LPRINT FF$;:GOSUB 380
260 IF PLN THEN LPRINT USING "#####";VAL(LEFT$(LIN$,P-2));:PLN=0
270 IF NE THEN LPRINT TAB(T-6);" ELSE ";:NE=0
280 X$=" ELSE ":GOSUB 320:IF NT THEN P2=NT-1:NE=NT
290 LPRINT TAB(T):S=0:WHILE ASC(MID$(LIN$,P+S))=32:S=S+1:WEND:P=P+S:LPRINT MID$(LIN$,P,P2-P+1):X$=" THEN ":GOSUB 320:IF NT THEN T=T+NT-P+6
300 IF NE THEN P2=P2+6
310 IF P2<LN THEN P=P2+1:X=P:GOTO 190 ELSE 180
320 Z9=P
330 NT=INSTR(Z9,LIN$,X$):IF NT=0 OR NT>P2 OR R<NT THEN NT=0:GOTO 370
340 Q1=INSTR(Z9,LIN$,Q$):IF Q1=0 OR Q1>NT THEN 370